package com.heima.leetcode.practice;

/**
 * @author 勾新杰
 * @version 1.0
 * @description: leetcode 171. Excel 表列序号
 * @date 2025/3/25 20:10
 */
public class E171 {
    public int titleToNumber(String columnTitle) {
        int res = 0, mul = 1;
        char[] charArray = columnTitle.toCharArray();
        for (int i = charArray.length - 1; i >= 0; i--) {
            res += (charArray[i] - 'A' + 1) * mul;
            mul *= 26;
        }
        return res;
    }
}
